package com.youth.youthservice.controller;


import com.youth.commonutils.R;
import com.youth.youthservice.entity.EduSubject;
import com.youth.youthservice.entity.vo.CourseVo.SubjectParam;
import com.youth.youthservice.service.EduSubjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * <p>
 * 课程科目 前端控制器
 * </p>
 *
 * @author WYZ
 * @since 2023-4-27
 */
@Api(description="课程分类信息")
@RestController
@RequestMapping("/eduservice/subject")
//使用nginx是需要使用@CrossOrigin解决跨域问题的，现在使用gateway网关替代
public class EduSubjectController {


    @Autowired
    private EduSubjectService subjectService;

    @GetMapping("getAllSubject")
    public R getAllSubject4Publish(){
        return subjectService.getAllSubject4Publish();
    }

    @GetMapping("getOneLevelSubjects")
    public R getOneLevelSubjects(){
        return subjectService.getOneLevelSubjects();
    }

    @PostMapping("addSubject")
    public R addSubject(@RequestBody SubjectParam subjectParam){
        return subjectService.addSubject(subjectParam);
    }

    @DeleteMapping("{id}/{parentId}")
    public R remove(@PathVariable("id") String id, @PathVariable("parentId") String parentId){
        return subjectService.removeSubject(id,parentId);
    }

}

